package com.titaniume.java2;

import org.junit.Test;

import java.lang.reflect.AnnotatedType;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 *@program: java8
 *@description: 重复注解与类型注解
 *@author: renfei.huang
 *@create: 2021-11-01 14:50
 */
public class TestAnnotation {


    @Test
    public void test1() throws NoSuchMethodException {
        Class<TestAnnotation> clazz = TestAnnotation.class;
        Method method = clazz.getMethod("test");


        MyAnnotation[] myAnnotations = method.getAnnotationsByType(MyAnnotation.class);

        for (MyAnnotation myAnnotation : myAnnotations) {
            System.out.println(myAnnotation.value());
        }


    }


    @MyAnnotation("nihao")
    @MyAnnotation("nihao")
    public void  test(){

    }
}
